import logging
import time
from common.decorators.log_decorator import log_decorator
from common.time_helpers import current_time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


log_config_dict = {
        "log-level": logging.INFO,
        "log-file-path": "./logs/{CONFIGURER_NAME}/"+current_time(),
        "log-file-mode": 'a',
        "log-format": "%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s"
}

@log_decorator(log_config_dict)
class Configurer():
    def setup_method(self, method):
        self.driver = webdriver.Firefox()
        self.vars = {}

    def teardown_method(self, method):
        self.driver.quit()

    def configure(self, url):
        self.setup_method(0)
        self.logger.info("start configuring " + url + "... ")
        #
        # your code here.
        #
        self.logger.info(url + " configured.")
        self.teardown_method(0)

    def __str__(self):
        return "{CONFIGURER_NAME}"